package com.example.smartwaterapi.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.function.Function;

/**
 * 用户表盘库实体类
 */
@Data
@TableName("user_watchfaces")
@Accessors(chain = true)
public class UserWatchface implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 表盘ID
     */
    private Long watchfaceId;

    /**
     * 获取方式 1:购买 2:免费下载 3:会员获取 4:积分兑换 5:自己创作
     */
    private Integer acquireType;

    /**
     * 支付金额
     */
    private BigDecimal pricePaid;

    /**
     * 使用积分
     */
    private Integer pointsUsed;

    /**
     * 下载次数
     */
    private Integer downloadCount;

    /**
     * 安装次数
     */
    private Integer installCount;

    /**
     * 是否收藏
     */
    private Integer isFavorite;

    /**
     * 最后使用时间
     */
    private LocalDateTime lastUsedAt;

    /**
     * 创建时间
     */
    private LocalDateTime createdAt;

    /**
     * 更新时间
     */
    private LocalDateTime updatedAt;
    
    // Static fields for lambda cache support
    public static final Function<UserWatchface, Long> ID = UserWatchface::getId;
    public static final Function<UserWatchface, Long> USER_ID = UserWatchface::getUserId;
    public static final Function<UserWatchface, Long> WATCHFACE_ID = UserWatchface::getWatchfaceId;
    public static final Function<UserWatchface, Integer> IS_FAVORITE = UserWatchface::getIsFavorite;
} 